/*
 */

package com.railway.system.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import cn.org.rapid_framework.util.DateConvertUtils;
import com.railway.common.base.BaseEntity;

/**
 * @author  jiangcheng
 * @version 1.0
 * @since 1.0
 */


public class SysUser extends BaseEntity implements java.io.Serializable {
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "系统用户";
	public static final String ALIAS_ID = "ID";
	public static final String ALIAS_USER_ID = "用户ID";
	public static final String ALIAS_USER_NAME = "用户名";
	public static final String ALIAS_USER_PWD = "密码";
	public static final String ALIAS_CARD_TYPE = "卡类型";
	public static final String ALIAS_CARD_ID = "卡号";
	public static final String ALIAS_POSITION = "职位";
	public static final String ALIAS_USER_NO = "用户号";
	public static final String ALIAS_COMPANY_ADD = "公司地址";
	public static final String ALIAS_DEPT_NAME = "部门";
	public static final String ALIAS_AREA_ID = "可登陆范围";
	public static final String ALIAS_BIRTHDAY = "生日";
	public static final String ALIAS_EMAIL = "电子邮件";
	public static final String ALIAS_PHONE = "固定电话";
	public static final String ALIAS_MOBILE = "移动电话";
	public static final String ALIAS_FAMILY_ADDR = "家庭地址";
	public static final String ALIAS_SEX = "性别";
	public static final String ALIAS_FAX = "传真";
	public static final String ALIAS_CREATOR = "创建者";
	public static final String ALIAS_CREATE_TIME = "创建时间";
	public static final String ALIAS_USER_STATUS = "用户状态";
	public static final String ALIAS_DELETED = "已删除";
	public static final String ALIAS_MEMO = "备注";
	public static final String ALIAS_LAST_LOGIN = "上次登录时间";
	
	//date formats
	public static final String FORMAT_BIRTHDAY = DATE_FORMAT;
	public static final String FORMAT_CREATE_TIME = DATE_FORMAT;
	public static final String FORMAT_LAST_LOGIN = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	@Length(max=32)
	private java.lang.String id;
	@Length(max=255)
	private java.lang.String userId;
	@Length(max=255)
	private java.lang.String userName;
	@Length(max=255)
	private java.lang.String userPwd;
	@Length(max=2)
	private java.lang.String cardType;
	@Length(max=100)
	private java.lang.String cardId;
	@Length(max=100)
	private java.lang.String position;
	@Length(max=100)
	private java.lang.String userNo;
	@Length(max=200)
	private java.lang.String companyAdd;
	@Length(max=32)
	private java.lang.String deptId;
	@Length(max=32)
	private java.lang.String areaId;
	
	private java.util.Date birthday;
	@Length(max=100)
	private java.lang.String email;
	@Length(max=100)
	private java.lang.String phone;
	@Length(max=13)
	private java.lang.String mobile;
	@Length(max=100)
	private java.lang.String familyAddr;
	@Length(max=2)
	private java.lang.String sex;
	@Length(max=20)
	private java.lang.String fax;
	@Length(max=32)
	private java.lang.String creator;
	
	private java.util.Date createTime;
	@Length(max=1)
	private java.lang.String userStatus;
	@Length(max=1)
	private java.lang.String deleted;
	@Length(max=100)
	private java.lang.String memo;
	
	private java.util.Date lastLogin;
	
	private String deptName = null;
	//columns END

	public SysUser(){
	}

	public SysUser(
		java.lang.String id
	){
		this.id = id;
	}

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	public java.lang.String getId() {
		return this.id;
	}
	public void setUserId(java.lang.String value) {
		this.userId = value;
	}
	
	public java.lang.String getUserId() {
		return this.userId;
	}
	public void setUserName(java.lang.String value) {
		this.userName = value;
	}
	
	public java.lang.String getUserName() {
		return this.userName;
	}
	public void setUserPwd(java.lang.String value) {
		this.userPwd = value;
	}
	
	public java.lang.String getUserPwd() {
		return this.userPwd;
	}
	public void setCardType(java.lang.String value) {
		this.cardType = value;
	}
	
	public java.lang.String getCardType() {
		return this.cardType;
	}
	public void setCardId(java.lang.String value) {
		this.cardId = value;
	}
	
	public java.lang.String getCardId() {
		return this.cardId;
	}
	public void setPosition(java.lang.String value) {
		this.position = value;
	}
	
	public java.lang.String getPosition() {
		return this.position;
	}
	public void setUserNo(java.lang.String value) {
		this.userNo = value;
	}
	
	public java.lang.String getUserNo() {
		return this.userNo;
	}
	public void setCompanyAdd(java.lang.String value) {
		this.companyAdd = value;
	}
	
	public java.lang.String getCompanyAdd() {
		return this.companyAdd;
	}
	public void setDeptId(java.lang.String value) {
		this.deptId = value;
	}
	
	public java.lang.String getDeptId() {
		return this.deptId;
	}
	public void setAreaId(java.lang.String value) {
		this.areaId = value;
	}
	
	public java.lang.String getAreaId() {
		return this.areaId;
	}
	public String getBirthdayString() {
		return DateConvertUtils.format(getBirthday(), FORMAT_BIRTHDAY);
	}
	public void setBirthdayString(String value) {
		setBirthday(DateConvertUtils.parse(value, FORMAT_BIRTHDAY,java.util.Date.class));
	}
	
	public void setBirthday(java.util.Date value) {
		this.birthday = value;
	}
	
	public java.util.Date getBirthday() {
		return this.birthday;
	}
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	public java.lang.String getEmail() {
		return this.email;
	}
	public void setPhone(java.lang.String value) {
		this.phone = value;
	}
	
	public java.lang.String getPhone() {
		return this.phone;
	}
	public void setMobile(java.lang.String value) {
		this.mobile = value;
	}
	
	public java.lang.String getMobile() {
		return this.mobile;
	}
	public void setFamilyAddr(java.lang.String value) {
		this.familyAddr = value;
	}
	
	public java.lang.String getFamilyAddr() {
		return this.familyAddr;
	}
	public void setSex(java.lang.String value) {
		this.sex = value;
	}
	
	public java.lang.String getSex() {
		return this.sex;
	}
	public void setFax(java.lang.String value) {
		this.fax = value;
	}
	
	public java.lang.String getFax() {
		return this.fax;
	}
	public void setCreator(java.lang.String value) {
		this.creator = value;
	}
	
	public java.lang.String getCreator() {
		return this.creator;
	}
	public String getCreateTimeString() {
		return DateConvertUtils.format(getCreateTime(), FORMAT_CREATE_TIME);
	}
	public void setCreateTimeString(String value) {
		setCreateTime(DateConvertUtils.parse(value, FORMAT_CREATE_TIME,java.util.Date.class));
	}
	
	public void setCreateTime(java.util.Date value) {
		this.createTime = value;
	}
	
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	public void setUserStatus(java.lang.String value) {
		this.userStatus = value;
	}
	
	public java.lang.String getUserStatus() {
		return this.userStatus;
	}
	public void setDeleted(java.lang.String value) {
		this.deleted = value;
	}
	
	public java.lang.String getDeleted() {
		return this.deleted;
	}
	public void setMemo(java.lang.String value) {
		this.memo = value;
	}
	
	public java.lang.String getMemo() {
		return this.memo;
	}
	public String getLastLoginString() {
		return DateConvertUtils.format(getLastLogin(), FORMAT_LAST_LOGIN);
	}
	public void setLastLoginString(String value) {
		setLastLogin(DateConvertUtils.parse(value, FORMAT_LAST_LOGIN,java.util.Date.class));
	}
	
	public void setLastLogin(java.util.Date value) {
		this.lastLogin = value;
	}
	
	public java.util.Date getLastLogin() {
		return this.lastLogin;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("UserId",getUserId())
			.append("UserName",getUserName())
			.append("UserPwd",getUserPwd())
			.append("CardType",getCardType())
			.append("CardId",getCardId())
			.append("Position",getPosition())
			.append("UserNo",getUserNo())
			.append("CompanyAdd",getCompanyAdd())
			.append("DeptId",getDeptId())
			.append("AreaId",getAreaId())
			.append("Birthday",getBirthday())
			.append("Email",getEmail())
			.append("Phone",getPhone())
			.append("Mobile",getMobile())
			.append("FamilyAddr",getFamilyAddr())
			.append("Sex",getSex())
			.append("Fax",getFax())
			.append("Creator",getCreator())
			.append("CreateTime",getCreateTime())
			.append("UserStatus",getUserStatus())
			.append("Deleted",getDeleted())
			.append("Memo",getMemo())
			.append("LastLogin",getLastLogin())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof SysUser == false) return false;
		if(this == obj) return true;
		SysUser other = (SysUser)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}

	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
}

